
obj/bootblock.o:     file format elf32-i386


Disassembly of section .text:

00007c00 <start>:
.set CR0_PE_ON,				0x1						# protected mode enable flag

.globl start
start:
.code16												# Assemble for 16-bit mode
	cli												# Disable interrupts 表示将处理器标志寄存器的中断标志位清0,不允许中断
    7c00:	fa                   	cli    
	cld												# String operations increment CLD使DF复位，即DF=0
    7c01:	fc                   	cld    

	# Set up the important data segment registers (DS, ES, SS).
	xorw %ax, %ax									# Segment number zero
    7c02:	31 c0                	xor    %eax,%eax
	movw %ax, %ds									# -> Data Segment
    7c04:	8e d8                	mov    %eax,%ds
	movw %ax, %es									# -> Extra Segment
    7c06:	8e c0                	mov    %eax,%es
	movw %ax, %ss									# -> Stack Segment
    7c08:	8e d0                	mov    %eax,%ss

00007c0a <seta20.1>:
	# Enable A20:
	#  For backwards compatibility with the earliest PCs, physical
	#  address line 20 is tied low, so that addresses higher than
	#  1MB wrap around to zero by default. This code undoes this.
seta20.1:
	inb $0x64, %al									# Wait for not busy
    7c0a:	e4 64                	in     $0x64,%al
	testb $0x2, %al
    7c0c:	a8 02                	test   $0x2,%al
	jnz seta20.1
    7c0e:	75 fa                	jne    7c0a <seta20.1>

	movb $0xd1, %al									# 0xd1 -> port 0x64
    7c10:	b0 d1                	mov    $0xd1,%al
	outb %al, $0x64
    7c12:	e6 64                	out    %al,$0x64

00007c14 <seta20.2>:

seta20.2:
	inb $0x64, %al									# Wait for not busy
    7c14:	e4 64                	in     $0x64,%al
	testb $0x2, %al
    7c16:	a8 02                	test   $0x2,%al
	jnz seta20.2
    7c18:	75 fa                	jne    7c14 <seta20.2>

	movb $0xdf, %al									# 0xdf -> port 0x60
    7c1a:	b0 df                	mov    $0xdf,%al
	outb %al, $0x60
    7c1c:	e6 60                	out    %al,$0x60

	# Switch from real to protected mode, using a bootstrap GDT
	# and segment translation that makes virtual addresses
	# identical to physical addresses, so that the
	# effective memory map does not change during the switch.
	lgdt gdtdesc
    7c1e:	0f 01 16             	lgdtl  (%esi)
    7c21:	6c                   	insb   (%dx),%es:(%edi)
    7c22:	7c 0f                	jl     7c33 <protcseg+0x1>
	movl %cr0, %eax
    7c24:	20 c0                	and    %al,%al
	orl $CR0_PE_ON, %eax
    7c26:	66 83 c8 01          	or     $0x1,%ax
	movl %eax, %cr0
    7c2a:	0f 22 c0             	mov    %eax,%cr0

	# Jump to next instruction, but in 32-bit code segment.
	# Switches processor into 32-bit mode.
	ljmp $PROT_MODE_CSEG, $protcseg
    7c2d:	ea 32 7c 08 00 66 b8 	ljmp   $0xb866,$0x87c32

00007c32 <protcseg>:

.code32												# Assemble for 32-bit mode
protcseg:
	# Set up the protected-mode data segment registers
	movw $PROT_MODE_DSEG, %ax						# Our data segment selector
    7c32:	66 b8 10 00          	mov    $0x10,%ax
	movw %ax, %ds									# -> DS: Data Segment
    7c36:	8e d8                	mov    %eax,%ds
	movw %ax, %es									# -> ES: Extra Segment
    7c38:	8e c0                	mov    %eax,%es
	movw %ax, %fs									# -> FS
    7c3a:	8e e0                	mov    %eax,%fs
	movw %ax, %gs									# -> GS
    7c3c:	8e e8                	mov    %eax,%gs
	movw %ax, %ss									# -> SS: Stack Segment
    7c3e:	8e d0                	mov    %eax,%ss

	# Set up the stack pointer and call into C.
	movl $0x0, %ebp
    7c40:	bd 00 00 00 00       	mov    $0x0,%ebp
	movl $start, %esp
    7c45:	bc 00 7c 00 00       	mov    $0x7c00,%esp
	call bootmain
    7c4a:	e8 25 00 00 00       	call   7c74 <bootmain>

00007c4f <spin>:

	# If bootmain returns (it shouldn't), loop.
spin:
	jmp spin
    7c4f:	eb fe                	jmp    7c4f <spin>
    7c51:	8d 76 00             	lea    0x0(%esi),%esi

00007c54 <gdt>:
	...
    7c5c:	ff                   	(bad)  
    7c5d:	ff 00                	incl   (%eax)
    7c5f:	00 00                	add    %al,(%eax)
    7c61:	9a cf 00 ff ff 00 00 	lcall  $0x0,$0xffff00cf
    7c68:	00 92 cf 00 17 00    	add    %dl,0x1700cf(%edx)

00007c6c <gdtdesc>:
    7c6c:	17                   	pop    %ss
    7c6d:	00 54 7c 00          	add    %dl,0x0(%esp,%edi,2)
    7c71:	00 90 90 55 89 e5    	add    %dl,-0x1a76aa70(%eax)

00007c74 <bootmain>:
	}
}

/* bootmain - the entry of bootloader */
void bootmain(void) 
{
    7c74:	55                   	push   %ebp
    7c75:	89 e5                	mov    %esp,%ebp
    7c77:	57                   	push   %edi
    7c78:	56                   	push   %esi
    7c79:	53                   	push   %ebx
    7c7a:	83 ec 08             	sub    $0x8,%esp
    7c7d:	c7 45 f0 71 7d 00 00 	movl   $0x7d71,-0x10(%ebp)
    7c84:	e9 d9 00 00 00       	jmp    7d62 <bootmain+0xee>
static void cons_puts(const char *str) 
{
	int i;
	for (i = 0; *str != '\0'; i ++) 
	{
		cons_putc(*str ++);
    7c89:	0f be f8             	movsbl %al,%edi
    7c8c:	31 db                	xor    %ebx,%ebx
static inline void outb(uint16_t port, uint8_t data) __attribute__((always_inline));

static inline uint8_t inb(uint16_t port) 
{
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
    7c8e:	b9 84 00 00 00       	mov    $0x84,%ecx
    7c93:	eb 07                	jmp    7c9c <bootmain+0x28>
    7c95:	89 ca                	mov    %ecx,%edx
    7c97:	ec                   	in     (%dx),%al
    7c98:	ec                   	in     (%dx),%al
    7c99:	ec                   	in     (%dx),%al
    7c9a:	ec                   	in     (%dx),%al

/* lpt_putc - copy console output to parallel port */
static void lpt_putc(int c) 
{
	int i;
	for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) 
    7c9b:	43                   	inc    %ebx
    7c9c:	ba 79 03 00 00       	mov    $0x379,%edx
    7ca1:	ec                   	in     (%dx),%al
    7ca2:	84 c0                	test   %al,%al
    7ca4:	78 08                	js     7cae <bootmain+0x3a>
    7ca6:	81 fb 00 32 00 00    	cmp    $0x3200,%ebx
    7cac:	75 e7                	jne    7c95 <bootmain+0x21>
	{
		delay();
	}
	outb(LPTPORT + 0, c);
    7cae:	89 fa                	mov    %edi,%edx
    7cb0:	89 f8                	mov    %edi,%eax
    7cb2:	88 55 ef             	mov    %dl,-0x11(%ebp)
	return data;
}

static inline void outb(uint16_t port, uint8_t data) 
{
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
    7cb5:	ba 78 03 00 00       	mov    $0x378,%edx
    7cba:	ee                   	out    %al,(%dx)
    7cbb:	b0 0d                	mov    $0xd,%al
    7cbd:	b2 7a                	mov    $0x7a,%dl
    7cbf:	ee                   	out    %al,(%dx)
    7cc0:	b0 08                	mov    $0x8,%al
    7cc2:	ee                   	out    %al,(%dx)
    7cc3:	bb d4 03 00 00       	mov    $0x3d4,%ebx
    7cc8:	b0 0e                	mov    $0xe,%al
    7cca:	89 da                	mov    %ebx,%edx
    7ccc:	ee                   	out    %al,(%dx)
static inline void outb(uint16_t port, uint8_t data) __attribute__((always_inline));

static inline uint8_t inb(uint16_t port) 
{
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
    7ccd:	be d5 03 00 00       	mov    $0x3d5,%esi
    7cd2:	89 f2                	mov    %esi,%edx
    7cd4:	ec                   	in     (%dx),%al
{
	int pos;

	// cursor position: col + 80*row.
	outb(CRTPORT, 14);
	pos = inb(CRTPORT + 1) << 8;
    7cd5:	0f b6 c8             	movzbl %al,%ecx
	return data;
}

static inline void outb(uint16_t port, uint8_t data) 
{
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
    7cd8:	89 da                	mov    %ebx,%edx
    7cda:	c1 e1 08             	shl    $0x8,%ecx
    7cdd:	b0 0f                	mov    $0xf,%al
    7cdf:	ee                   	out    %al,(%dx)
static inline void outb(uint16_t port, uint8_t data) __attribute__((always_inline));

static inline uint8_t inb(uint16_t port) 
{
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
    7ce0:	89 f2                	mov    %esi,%edx
    7ce2:	ec                   	in     (%dx),%al
	outb(CRTPORT, 15);
	pos |= inb(CRTPORT + 1);
    7ce3:	0f b6 f0             	movzbl %al,%esi
    7ce6:	09 f1                	or     %esi,%ecx

	if (c == '\n') 
    7ce8:	83 ff 0a             	cmp    $0xa,%edi
    7ceb:	75 11                	jne    7cfe <bootmain+0x8a>
	{
		pos += 80 - pos % 80;
    7ced:	89 c8                	mov    %ecx,%eax
    7cef:	bb 50 00 00 00       	mov    $0x50,%ebx
    7cf4:	99                   	cltd   
    7cf5:	83 c1 50             	add    $0x50,%ecx
    7cf8:	f7 fb                	idiv   %ebx
    7cfa:	29 d1                	sub    %edx,%ecx
    7cfc:	eb 13                	jmp    7d11 <bootmain+0x9d>
	}
	else 
	{
		crt[pos ++] = (c & 0xff) | 0x0700;
    7cfe:	66 81 e7 ff 00       	and    $0xff,%di
    7d03:	66 81 cf 00 07       	or     $0x700,%di
    7d08:	66 89 bc 09 00 80 0b 	mov    %di,0xb8000(%ecx,%ecx,1)
    7d0f:	00 
    7d10:	41                   	inc    %ecx
	return data;
}

static inline void outb(uint16_t port, uint8_t data) 
{
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
    7d11:	bb d4 03 00 00       	mov    $0x3d4,%ebx
    7d16:	b0 0e                	mov    $0xe,%al
    7d18:	89 da                	mov    %ebx,%edx
    7d1a:	ee                   	out    %al,(%dx)
    7d1b:	be d5 03 00 00       	mov    $0x3d5,%esi
    7d20:	89 c8                	mov    %ecx,%eax
    7d22:	c1 f8 08             	sar    $0x8,%eax
    7d25:	89 f2                	mov    %esi,%edx
    7d27:	ee                   	out    %al,(%dx)
    7d28:	b0 0f                	mov    $0xf,%al
    7d2a:	89 da                	mov    %ebx,%edx
    7d2c:	ee                   	out    %al,(%dx)
    7d2d:	88 c8                	mov    %cl,%al
    7d2f:	89 f2                	mov    %esi,%edx
    7d31:	ee                   	out    %al,(%dx)
    7d32:	31 db                	xor    %ebx,%ebx
static inline void outb(uint16_t port, uint8_t data) __attribute__((always_inline));

static inline uint8_t inb(uint16_t port) 
{
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
    7d34:	be fd 03 00 00       	mov    $0x3fd,%esi
    7d39:	b9 84 00 00 00       	mov    $0x84,%ecx
    7d3e:	eb 07                	jmp    7d47 <bootmain+0xd3>
    7d40:	89 ca                	mov    %ecx,%edx
    7d42:	ec                   	in     (%dx),%al
    7d43:	ec                   	in     (%dx),%al
    7d44:	ec                   	in     (%dx),%al
    7d45:	ec                   	in     (%dx),%al

/* serial_putc - copy console output to serial port */
static void serial_putc(int c) 
{
    int i;
	for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) 
    7d46:	43                   	inc    %ebx
    7d47:	89 f2                	mov    %esi,%edx
    7d49:	ec                   	in     (%dx),%al
    7d4a:	a8 14                	test   $0x14,%al
    7d4c:	75 08                	jne    7d56 <bootmain+0xe2>
    7d4e:	81 fb 00 32 00 00    	cmp    $0x3200,%ebx
    7d54:	75 ea                	jne    7d40 <bootmain+0xcc>
static void cons_puts(const char *str) 
{
	int i;
	for (i = 0; *str != '\0'; i ++) 
	{
		cons_putc(*str ++);
    7d56:	ff 45 f0             	incl   -0x10(%ebp)
	return data;
}

static inline void outb(uint16_t port, uint8_t data) 
{
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
    7d59:	ba f8 03 00 00       	mov    $0x3f8,%edx
    7d5e:	8a 45 ef             	mov    -0x11(%ebp),%al
    7d61:	ee                   	out    %al,(%dx)

/* cons_puts - print a string to console */
static void cons_puts(const char *str) 
{
	int i;
	for (i = 0; *str != '\0'; i ++) 
    7d62:	8b 55 f0             	mov    -0x10(%ebp),%edx
    7d65:	8a 02                	mov    (%edx),%al
    7d67:	84 c0                	test   %al,%al
    7d69:	0f 85 1a ff ff ff    	jne    7c89 <bootmain+0x15>
    7d6f:	eb fe                	jmp    7d6f <bootmain+0xfb>
